unit Unit2;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm2 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form2: TForm2;

implementation

uses
  Unit1;

{$R *.dfm}

procedure TForm2.Button1Click(Sender: TObject);
var
  action:TCloseAction;
begin
  if Assigned(form1.OnClose) then
  begin
    Form1.OnClose(Form1,action);
  end;

  if action=caNone then
  begin
    ShowMessage('canone');
  end;  

  Application.Terminate;
end;

end.
